package com.multi.thread.chapter03.demo14;

public class DBTools {
	
	volatile private boolean isRun = false;
	
	synchronized public void backupA() {
		try {
			while (isRun == true) {
				this.wait();
			}
			for (int i = 0; i < 5; i++) {
				System.out.println("★★★★★");
			}
			isRun = true;
			notifyAll();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	synchronized public void backupB() {
		try {
			while (isRun == false) {
				this.wait();
			}
			for (int i = 0; i < 5; i++) {
				System.out.println("☆☆☆☆☆");
			}
			isRun = false;
			notifyAll();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

}
